const connection = require('../app/database')

class focusService {
    async create(postId, userId) {
        try {
            const statement = `INSERT INTO article_like(article_id,user_id) VALUES(?,?);`;
            const [result] = await connection.execute(statement, [postId, userId])
            return result
        } catch (error) {
            console.log('likeServiceCreate', error)
        }
    }

    async detele(postId, userId) {
        try {
            const statement = `DELETE FROM article_like WHERE article_id = ?;`;
            const [result] = await connection.execute(statement, [postId])
            return result
        } catch (error) {
            console.log('likeServiceCreate', error)
        }
    }
}

module.exports = new focusService()
